package c.h.a.j0;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import c.h.a.b0.o;
import c.h.a.d0.d;
import c.h.a.m0.k;
import c.h.a.m0.p.a;
import com.liuzh.deviceinfo.DeviceInfoApp;
import com.liuzh.deviceinfo.analyzer.StorageAnalyzeActivity;
import java.util.Locale;
import java.util.concurrent.RejectedExecutionException;

/* compiled from: TabStorage */
public class x0 extends h0 {
    public ViewGroup W;
    public LinearLayout X;
    public String Y;

    public View G(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        if (this.W == null) {
            viewGroup = (ViewGroup) layoutInflater.inflate(2131493058, viewGroup, false);
            this.W = viewGroup;
            this.X = (LinearLayout) viewGroup.findViewById(2131296476);
            a0 a0Var = new a0(this, layoutInflater);
            Handler handler = a.a;
            try {
                a.c.execute(a0Var);
            } catch (RejectedExecutionException unused) {
            }
        }
        return this.W;
    }

    public void O(int i, String[] strArr, int[] iArr) {
        if (i != 1) {
            return;
        }
        if (c.h.a.e0.a.f(iArr)) {
            StorageAnalyzeActivity.C(Z(), this.Y);
        } else if (!c.h.a.e0.a.d(this, "android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.READ_EXTERNAL_STORAGE")) {
            o.r0(h(), 2131690076, 2131690406);
        }
    }

    public String r0() {
        return DeviceInfoApp.c.getString(2131690403);
    }

    @SuppressLint({"SetTextI18n"})
    public final View s0(String str, d dVar, LayoutInflater layoutInflater) {
        View inflate = layoutInflater.inflate(2131492995, this.X, false);
        double d = dVar.d;
        double d2 = dVar.b;
        ((TextView) inflate.findViewById(2131297054)).setText(str);
        ((TextView) inflate.findViewById(2131296786)).setText(dVar.f);
        int i = (int) ((d / d2) * 100.0d);
        ProgressBar progressBar = (ProgressBar) inflate.findViewById(2131296806);
        progressBar.setProgress(i);
        progressBar.setId(progressBar.hashCode());
        TextView textView = (TextView) inflate.findViewById(2131296790);
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(i);
        stringBuilder.append("%");
        textView.setText(stringBuilder.toString());
        StringBuilder stringBuilder2 = new StringBuilder();
        stringBuilder2.append(DeviceInfoApp.c.getString(2131690543));
        String str2 = ": ";
        stringBuilder2.append(str2);
        Object[] objArr = new Object[]{Double.valueOf(d)};
        String str3 = "%.1f";
        stringBuilder2.append(String.format(Locale.getDefault(), str3, objArr));
        String str4 = " GB";
        stringBuilder2.append(str4);
        str = stringBuilder2.toString();
        stringBuilder = new StringBuilder();
        stringBuilder.append(DeviceInfoApp.c.getString(2131690456));
        stringBuilder.append(str2);
        stringBuilder.append(String.format(Locale.getDefault(), str3, new Object[]{Double.valueOf(d2)}));
        stringBuilder.append(str4);
        ((TextView) inflate.findViewById(2131297011)).setText(c.b.a.a.a.E(str, ",  ", stringBuilder.toString()));
        CharSequence r = k.r(dVar.f);
        if (TextUtils.isEmpty(r) && TextUtils.equals(dVar.f, Environment.getRootDirectory().getAbsolutePath())) {
            r = k.r("/");
        }
        if (!TextUtils.isEmpty(r)) {
            TextView textView2 = (TextView) inflate.findViewById(2131296891);
            textView2.setText(r);
            textView2.setVisibility(0);
        }
        return inflate;
    }
}
